﻿@model IList<OpenMVCRM.ViewModels.ContactPersonViewModel>
@{
    ViewBag.Title = "Contacts";
}
<fieldset>
 <div class="divContainer">
 <div class="divEditBar">
 <div class="divBreadCrump">
    <span>You are here : </span>
    <span> Contacts</span>
</div>
 <div class="divEditRightLinks"> 
    @Html.ActionLink("Create", "Create", "Contact")
</div>
</div>
 <div class="divContainer">
 <div class="divTblHolder">
<table cellpadding="0" cellspacing="0" class="tblListFull">
   <tr>
    <th></th> 
    <th>First Name</th>  
    <th>Last Name</th>
    <th>Email Address</th>
</tr>
   @foreach (var client in Model)
   {
      <tr class="trEditable" data_orderid="@client.ID" data-viewurl="@Url.Action("View", "Clients", new { @id = client.ID })">
        <td class="tdEditLink">
          <div class="divEditLink" style="display:none;">
          @Html.ActionLink("Edit", "Edit", "Clients", new { @id = client.ID }, null)
          </div>
        </td>  
        <td>@client.FirstName</td>
        <td>@client.LastName</td>
        <td>@client.EmailAddress</td>
    </tr>
   }
   <tr>
 <td colspan="4">
    <div class="divTblfooter">
  Total :  @Model.Count() Clients 
  </div>
 </td>
 </tr>
 </table>
</div>
</div>
</div>
</fieldset>

 <script type="text/javascript">
     $(function () {

         $(".trEditable").hover(function () {
             var item = $(this);
             item.addClass("trHovering").find(".divEditLink").show(); ;
         },
         function () {
             var item = $(this);
             item.removeClass("trHovering").find(".divEditLink").fadeOut(); ;
         }
         );

         $(".trEditable").click(function () {
             var item = $(this);
             window.location.href = item.data("viewurl");
         });
     }); 
 </script>

